#pragma once

#include "RBTree(copy).h"


namespace ltw
{
    template<class K>
    class set
    {
        struct SetKeyOfT
        {
            const K& operator()(const K& key)
            {
                return key;
            }
        };
    public:
        typedef typename RBTree<K,K,SetKeyOfT>::Iterator iterator;

        iterator begin()
        {
            return _t.Begin();
        }

        iterator end()
        {
            return _t.End();
        }


        bool insert(const K& key)
        {
            return _t.Insert(key);
        }
    private:
        RBTree<K,K,SetKeyOfT> _t;
    };

    void test_set()
    {
        set<int> s;
        int a[] = {4,2,6,1,3,5,15,7,16,14};
        for(auto e:a)
        {
            s.insert(e);
        }
        for(const auto& e:s)
        {
            cout << e << " ";
        }
        cout << endl;
    }
}